package com.redteam.data.beans;

import com.redteam.data.enums.PersonType;
import java.io.Serializable;
import java.sql.Date;

/**
 * @author Teddy Karam
 * @author Anthony Ferrari
 */
public class Person implements Serializable {

    private long id;
    private long fBOId;
    private String firstName;
    private String lastName;
    private String middleName;
    private String street;
    private String city;
    private String state;
    private String zipCode;
    private String email;
    private Date birthdate;
    private String homePhone;
    private String cellPhone;
    private String workPhone;
    private String gender;
    private PersonType discriminator;
    private String username;
    private String password;
    private static final long serialVersionUID = 1L;


    /**
     * Default constructor
     */
    public Person() {
    }

    /**
     * Full Constructor
     * @param id
     * @param firstName
     * @param middleName
     * @param lastName
     * @param street
     * @param city
     * @param state
     * @param zipCode
     * @param email
     * @param fBOId
     * @param birthdate
     * @param homePhone
     * @param cellPhone
     * @param workPhone
     * @param gender
     * @param type
     * @param username
     * @param password
     */
    public Person(long id, String firstName, String middleName, String lastName, String street, String city, String state, String zipCode, String email, long fBOId, Date birthdate, String homePhone, String cellPhone, String workPhone, String gender, String type, String username, String password) {
        this.setId(id);
        this.setFirstName(firstName);
        this.setLastName(lastName);
        this.setMiddleName(middleName);
        this.setStreet(street);
        this.setCity(city);
        this.setState(state);
        this.setZipCode(zipCode);
        this.setEmail(email);
        this.setfBOId(fBOId);
        this.setBirthDate(birthdate);
        this.setHomePhone(homePhone);
        this.setCellPhone(cellPhone);
        this.setWorkPhone(workPhone);
        this.setDiscriminator(type);
        this.setGender(gender);
        this.setUsername(username);
        this.setPassword(password);
    }

    /**
     * Returns the person's id
     * @return the id
     */
    public final long getId() {
        return id;
    }

    /**
     * Sets the person's id
     * @param id the id to set
     */
    public final void setId(long id) {
        this.id = id;
    }

    /**
     * Returns the first name
     * @return firstName
     */
    public final String getFirstName() {
        return firstName;
    }

    /**
     * Sets the first name
     * @param firstName the firstName to set
     */
    public final void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    /**
     * Returns the last name
     * @return lastName
     */
    public final String getLastName() {
        return lastName;
    }

    /**
     * @param lastName the lastName to set
     */
    public final void setLastName(String lastName) {
        this.lastName = lastName;
    }

    /**
     * Returns the middle name
     * @return middleName
     */
    public final String getMiddleName() {
        return middleName;
    }

    /**
     * Sets the middle name
     * @param middleName the middleName to set
     */
    public final void setMiddleName(String middleName) {
        this.middleName = middleName;
    }

    /**
     * Returns the street
     * @return street
     */
    public final String getStreet() {
        return street;
    }

    /**
     * Sets the street
     * @param street the street to set
     */
    public final void setStreet(String street) {
        this.street = street;
    }

    /**
     * Returns the city
     * @return city
     */
    public final String getCity() {
        return city;
    }

    /**
     * Sets the city
     * @param city the city to set
     */
    public final void setCity(String city) {
        this.city = city;
    }

    /**
     * Returns the state
     * @return state
     */
    public final String getState() {
        return state;
    }

    /**
     * Sets the state
     * @param state the state to set
     */
    public final void setState(String state) {
        this.state = state;
    }

    /**
     * Returns the zip code
     * @return zipCode
     */
    public final String getZipCode() {
        return zipCode;
    }

    /**
     * Sets the zip code
     * @param zipCode the zipCode to set
     */
    public final void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    /**
     * Returns the email
     * @return email
     */
    public final String getEmail() {
        return email;
    }

    /**
     * Sets the email
     * @param email the email to set
     */
    public final void setEmail(String email) {
        this.email = email;
    }

    /**
     * Returns the FBO id
     * @return fBOId
     */
    public final long getfBOId() {
        return fBOId;
    }

    /**
     * Sets the FBO id
     * @param fBOId the fBOId to set
     */
    public final void setfBOId(long fBOId) {
        this.fBOId = fBOId;
    }

    /**
     * Returns the date of birth
     * @return birthdate
     */
    public final Date getBirthDate() {
        return birthdate;
    }

    /**
     * Sets the date of birth
     * @param birthdate the birthdate to set
     */
    public final void setBirthDate(Date birthdate) {
        this.birthdate = birthdate;
    }

    /**
     * Returns the home phone number of the given person
     * @return homePhone
     */
    public final String getHomePhone() {
        return homePhone;
    }

    /**
     * Sets the home phone 
     * @param homePhone the homePhone to set
     */
    public final void setHomePhone(String homePhone) {
        this.homePhone = homePhone;
    }

    /**
     * Returns the cell phone number associated with that person
     * @return cellPhone
     */
    public final String getCellPhone() {
        return cellPhone;
    }

    /**
     * Sets the cell phone number
     * @param cellPhone the cellPhone to set
     */
    public final void setCellPhone(String cellPhone) {
        this.cellPhone = cellPhone;
    }

    /**
     * Returns the work phone number
     * @return workPhone
     */
    public final String getWorkPhone() {
        return workPhone;
    }

    /**
     * Sets the work phone number
     * @param workPhone the workPhone to set
     */
    public final void setWorkPhone(String workPhone) {
        this.workPhone = workPhone;
    }

    /**
     * Returns the person's discriminator
     * @return discriminator
     */
    public final String getDiscriminator() {
        return discriminator.getShortHand();
    }

    /**
     * Sets the person's discriminator
     * @param discriminator the discriminator to set
     */
    public final void setDiscriminator(String discriminator) {
        this.discriminator = PersonType.valueOf(discriminator);
    }

    /**
     * Returns the gender
     * @return gender
     */
    public final String getGender() {
        return gender;
    }

    /**
     * Sets the gender
     * @param gender the gender to set
     */
    public final void setGender(String gender) {
        this.gender = gender;
    }

    /**
     * Returns the password
     * @return password
     */
    public final String getPassword() {
        return password;
    }

    /**
     * Sets the password
     * @param password
     */
    public final void setPassword(String password) {
        this.password = password;
    }

    /**
     * Returns the username
     * @return username
     */
    public final String getUsername() {
        return username;
    }

    /**
     * Sets the person's username
     * @param userName
     */
    public final void setUsername(String userName) {
        this.username = userName;
    }
    /**
     * @inheritDoc
     * 
     */
    @Override
    public String toString() {
        return "Person{" + "id=" + id + "fBOId=" + fBOId + "firstName=" + firstName + "lastName=" + lastName + "middleName=" + middleName + "street=" + street + "city=" + city + "state=" + state + "zipCode=" + zipCode + "email=" + email + "birthdate=" + birthdate + "homePhone=" + homePhone + "cellPhone=" + cellPhone + "workPhone=" + workPhone + "gender=" + gender + "discriminator=" + discriminator + "username=" + username + "password=" + password + '}';
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Person other = (Person) obj;
        if (this.id != other.id) {
            return false;
        }
        if (this.fBOId != other.fBOId) {
            return false;
        }
        if ((this.firstName == null) ? (other.firstName != null) : !this.firstName.equals(other.firstName)) {
            return false;
        }
        if ((this.lastName == null) ? (other.lastName != null) : !this.lastName.equals(other.lastName)) {
            return false;
        }
        if ((this.middleName == null) ? (other.middleName != null) : !this.middleName.equals(other.middleName)) {
            return false;
        }
        if ((this.street == null) ? (other.street != null) : !this.street.equals(other.street)) {
            return false;
        }
        if ((this.city == null) ? (other.city != null) : !this.city.equals(other.city)) {
            return false;
        }
        if ((this.state == null) ? (other.state != null) : !this.state.equals(other.state)) {
            return false;
        }
        if ((this.zipCode == null) ? (other.zipCode != null) : !this.zipCode.equals(other.zipCode)) {
            return false;
        }
        if ((this.email == null) ? (other.email != null) : !this.email.equals(other.email)) {
            return false;
        }
        if (this.birthdate != other.birthdate && (this.birthdate == null || !this.birthdate.equals(other.birthdate))) {
            return false;
        }
        if ((this.homePhone == null) ? (other.homePhone != null) : !this.homePhone.equals(other.homePhone)) {
            return false;
        }
        if ((this.cellPhone == null) ? (other.cellPhone != null) : !this.cellPhone.equals(other.cellPhone)) {
            return false;
        }
        if ((this.workPhone == null) ? (other.workPhone != null) : !this.workPhone.equals(other.workPhone)) {
            return false;
        }
        if ((this.gender == null) ? (other.gender != null) : !this.gender.equals(other.gender)) {
            return false;
        }
        if (this.discriminator != other.discriminator) {
            return false;
        }
        if ((this.username == null) ? (other.username != null) : !this.username.equals(other.username)) {
            return false;
        }
        if ((this.password == null) ? (other.password != null) : !this.password.equals(other.password)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + (int) (this.id ^ (this.id >>> 32));
        hash = 37 * hash + (int) (this.fBOId ^ (this.fBOId >>> 32));
        hash = 37 * hash + (this.firstName != null ? this.firstName.hashCode() : 0);
        hash = 37 * hash + (this.lastName != null ? this.lastName.hashCode() : 0);
        hash = 37 * hash + (this.middleName != null ? this.middleName.hashCode() : 0);
        hash = 37 * hash + (this.street != null ? this.street.hashCode() : 0);
        hash = 37 * hash + (this.city != null ? this.city.hashCode() : 0);
        hash = 37 * hash + (this.state != null ? this.state.hashCode() : 0);
        hash = 37 * hash + (this.zipCode != null ? this.zipCode.hashCode() : 0);
        hash = 37 * hash + (this.email != null ? this.email.hashCode() : 0);
        hash = 37 * hash + (this.birthdate != null ? this.birthdate.hashCode() : 0);
        hash = 37 * hash + (this.homePhone != null ? this.homePhone.hashCode() : 0);
        hash = 37 * hash + (this.cellPhone != null ? this.cellPhone.hashCode() : 0);
        hash = 37 * hash + (this.workPhone != null ? this.workPhone.hashCode() : 0);
        hash = 37 * hash + (this.gender != null ? this.gender.hashCode() : 0);
        hash = 37 * hash + (this.discriminator != null ? this.discriminator.hashCode() : 0);
        hash = 37 * hash + (this.username != null ? this.username.hashCode() : 0);
        hash = 37 * hash + (this.password != null ? this.password.hashCode() : 0);
        return hash;
    }

}
